package com.yls.except.util;

import com.yls.except.task.RedisCash;

import java.util.Date;
import java.util.Map;

public class YzCodeTime {
	/**
	 * 根据电话号码验证改手机号获取验证码时间是否超过1分钟
	 * @param phone
	 * @return
     */
	public static boolean yzcode(String phone) {
		Map<String, String> yzmap = RedisCash.getMap("life" + phone);
		if(StringIsempty.isNullMap(yzmap))
			return false;
		long date = Long.parseLong(yzmap.get("date"));
		long now = new Date().getTime();
		long time = (now - date) / 1000 / 60;
		if(time < 1)
			return true;
		else
			return false;

	}
}
